/* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/tabs_animated_gradient_border.css made available under Mozilla Public License v. 2.0
See the above repository for updates as well as full license text. */

/** Adds animated gradient border below tabs and around selected tab.
 *
 * !IMPORTANT
 * This style requires non_floating_sharp_tabs.css to be loaded before it.
 */

/* Constant animation WILL increase CPU usage */

@media (-moz-platform: windows){
/* Increase tab minimum height by 2px on Windows as a workaround for titlebar being unable to collapse below 31px height */
  :root[uidensity="compact"]{ --tab-min-height: 31px !important; }
}

/*
Thanks to /u/skenera on reddit for suggesting animating background position and using steps() function to reduce cpu load
*/
@keyframes rotate-gradient{
  from{background-position: 0 0;}
  to{background-position: 200vw 0;}
}
#TabsToolbar{ background: none !important; }
#TabsToolbar::before{
  content: "";
  display: block;
  position: absolute;
  width: 200vw;
  height: calc(var(--tab-min-height) + var(--tab-block-margin) + 2px);
  background-image: linear-gradient(to right, magenta, red, yellow, green, cyan, blue, magenta);
  animation: rotate-gradient 10s steps(60) infinite;
  /*animation-timing-function: linear;  */ /* smoother animation, but greatly increased cpu use */
  pointer-events: none;
  z-index: 0;
}
#pinned-tabs-container,
#tabbrowser-arrowscrollbox{
  margin-inline: 0 !important;
  --tab-shadow-max-size: 0px;
}
scrollbox[orient="horizontal"] > slot::after,
.scrollbox-clip[orient="horizontal"] > scrollbox::after{
  content: "";
  display: flex;
  flex-grow: 1 !important;
  position: relative;
  background-color: var(--lwt-accent-color,var(--toolbox-bgcolor));
  margin-bottom: 1px;
}

#TabsToolbar > .titlebar-buttonbox-container,
.titlebar-spacer,
.tab-background,
.closing-tabs-spacer,
#tabs-newtab-button,
#scrollbutton-up,
#scrollbutton-down,
#tabbrowser-tabs ~ toolbarbutton{
  background-color: var(--lwt-accent-color,var(--toolbox-bgcolor)) !important;
  margin-bottom: 1px !important;
  opacity: 1 !important;
  position: relative;
}
.tabbrowser-tab:hover > .tab-stack > .tab-background:not([selected]),
.tab-background[multiselected]:not([selected]){
  background-image: linear-gradient(color-mix(in srgb, currentColor 11%, transparent),color-mix(in srgb, currentColor 11%, transparent)) !important;
  background-color: var(--lwt-accent-color,var(--toolbox-bgcolor)) !important;
}

.tabbrowser-tab:not([selected]){ min-height: calc(var(--tab-min-height) - 1px) !important;  }
.tabbrowser-tab{ margin-inline-start: 0 !important; }

vbox.tab-background[selected]{
  padding: 0px !important;
  border: 1px solid transparent !important;
  border-bottom-width: 0px !important;
  margin-bottom: 0px !important;
  background-clip: padding-box;
  outline: none !important;
}

/* remove selected tab line which isn't very useful with this style */
.tab-background[selected]::before{
  display: none !important;
}
#tabbrowser-tabs:not([secondarytext-unsupported]) .tab-label-container{
  height: var(--tab-min-height) !important;
}
.tab-label{ line-height: 20px !important; }
:root[uidensity="compact"] .tab-label{ line-height: 20px !important; }
:root[uidensity="normal"] .tab-content[selected]{ margin-top: -1px }

#nav-bar{ box-shadow: none !important; }
